package com.hedl.classroom.controller;

import com.hedl.classroom.model.dto.CoursePreviewDto;
import com.hedl.classroom.service.CoursePublishService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * ProjectName: onlinec-classroom
 * DateTime: 2023/7/23 17:25
 * Author: Big Watermelon
 * Description: 课程课程公开接口
 */
@Api(value = "课程课程公开接口",tags = "课程课程公开接口")
@Slf4j
@RestController
@RequestMapping("/open")
public class CourseOpenController {

    @Resource
    private CoursePublishService coursePublishService;

    @GetMapping("/course/whole/{courseId}")
    @ApiOperation("获取课程预览信息")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "courseId",value = "课程id",required = true,dataType = "Long")
    })
    public CoursePreviewDto getPreviewInfo(@PathVariable("courseId") Long courseId) {
        return coursePublishService.getCoursePreviewInfo(courseId);
    }
}
